home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Java for 3D & VRML Worlds
/
Java for 3d and VRML Worlds.iso
/
examples
/
chap04
/
LightOnOff.wrl
< prev
next >
Wrap
Text File
|
1996-10-14
|
1KB
|
47 lines
#VRML V2.0 utf8
#
# turn on/off the light by touching the lamp shade.
#
Transform{
children[
DEF LIGHT PointLight{
on TRUE
},
Transform{
translation 0 1 0
children[
# lamp shade
DEF LAMP_SHADE Shape{
geometry Cone{
height 2
bottomRadius 4
bottom FALSE
}
}
]
},
# sensor to turn the light on / off
DEF LIGHT_ON_SWITCH TouchSensor{}
]
}
# dummy object to reflect the light.
Transform{
translation 0 -5 0
children[
Shape{geometry Box{size 10 0.3 10}}
]
}
DEF LIGHT_SCRIPT Script{
url "LightOnOff.class"
eventIn SFTime touchTime
eventOut SFBool turnOnLight
}
ROUTE LIGHT_ON_SWITCH.touchTime TO LIGHT_SCRIPT.touchTime
ROUTE LIGHT_SCRIPT.turnOnLight TO LIGHT.on